import json

data_json = []
data_prepared = []
file_name = '../wine_data.json'
out_name = '../wine_data_v1.json'

with open(file_name, "r") as f:
    file_contents = f.readlines()

for content in file_contents:
    data_json.append(json.loads(content))

data_json = data_json[0]
data_out = []
for data in data_json:
    data.pop('title')
    data.pop('description')
    data.pop('designation')
    data.pop('region_1')
    data.pop('region_2')
    data.pop('taster_twitter_handle')
    data.pop('winery')

    data_out.append(json.dumps(data))
    values = data.values()
    for a in values:
        if a is None:
            data_out.pop()
            break


with open(out_name, "w") as f:
    for a in data_out:
        f.write(a + '\r')
